package org.nokatag.password;
import java.security.MessageDigest;

import sun.misc.BASE64Encoder;


/**
 * <p>@Title sha加密</p>
 * <p>@Description </p>
 * <p>@Version 1.0.0</p>
 * <p>@author rebin</p>
 * <p>@date 2017年1月5日</p>
 * <p>xiefangjian@163.com</p>
 * <p>Copyright © Noka Laboratory.All Rights Reserved.</p>
 */
public class SHAPlus {
	public  static String encryptSHA(byte[] data,String KEY_SHA) throws Exception {
		MessageDigest sha = MessageDigest.getInstance(KEY_SHA);
		sha.update(data);
		BASE64Encoder base64 = new BASE64Encoder();
		return base64.encode(sha.digest());
	}
	
	public static void main(String[] args){
		
	try {
		System.out.println(SHAPlus.encryptSHA("ssssssssssssssssssssssss".getBytes(), "SHA-384"));
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	}
}
